<!-- 个人中心 -->
<template>
	<view>
		<view style="display: flex;justify-content: center;">
			<view class="cu-avatar xl round" style="width: 100rpx;height: 100rpx;margin-top: 100rpx;">
				<u-avatar :src="giveUserInfo.avatar" size='large'></u-avatar>
			</view>

		</view>
		<view class="name">{{giveUserInfo.nickname}}</view>
		<view class="zhifu">
			<view class="zs">输入赠送金额</view>
			<view class="box">
				<!-- <text class="icon-search">¥</text> -->
				<!-- <input class="username" v-model="money"></input> -->
				<u-field v-model="money" label-width='50' label="￥" class="username"></u-field>
			</view>
			<view class="submit"  @click="submit">确定</view>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				userid: '',
				giveUserInfo: {},
				money: '',
				type: 1
			};
		},
		onLoad(option) {
			console.log(option)
			this.userid = option.userid
			this.type = option.type
			console.log('getuser', this.userid, this.type)
			this.getGiveUser()
		},
		methods: {
			getGiveUser() {
				this.$https('my.getGiveUserInfo', {
					user_id: this.userid
				}).then(res => {
					this.giveUserInfo = res.data
				})
			},
			confirm(e) {
				this.money = e.detail.value
			},
			submit() {
				let quatyData = {
					user_id: this.userid,
					type: this.type,
					amount: this.money
				}
				this.$https('my.giveDaijinquan', quatyData).then(res => {
					if (res.code == 1) {
						uni.showToast({
								title: res.msg,
								icon: "none"
							}),
							uni.navigateBack({
								delta: 1
							})
					} else {
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 1500)
					}
				})
			}
		},
	}
</script>
<style>
	/*  page {
        height: 100%;
        background: #ffffff !important;
    } */
</style>
<style lang="scss" scoped>
	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;

	}

	.submit {
		width: 343px;
		height: 49px;
		background: linear-gradient(90deg, #FC5351 0%, #FF6E6D 100%);
		border-radius: 37px 37px 37px 37px;
		opacity: 1;
		margin: 108rpx auto;
		display: flex;
		justify-content: center;
		align-items: center;
		text-align: center;
		color: white;
	}

	.personal-wrap {
		padding-bottom: 100rpx;
	}

	.name {
		display: flex;
		justify-content: center;
		font-size: 32rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #333333;
		line-height: 38rpx;
		margin-top: 20rpx;
	}

	.zhifu {
		// width: 375px;
		height: 536rpx;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		opacity: 1;
		margin-top: 44rpx;
		margin-left: 24rpx;
		margin-right: 24rpx;
	}

	.zs {
		font-size: 28rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #777777;
		line-height: 32rpx;
		margin-left: 24rpx;
		padding-top: 40rpx;
	}

	.box {
		// width: 200px;
		position: relative;
		margin-left: 24rpx;
		margin-right: 24rpx;
		margin-top: 20rpx;
		border-bottom: 1px solid #F3F3F3; 
		font-size: 60rpx;
		font-weight: 700;

	}

	.box .icon-search {
		width: 56rpx;
		font-size: 60rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #333333;
		position: absolute;
		top: 13rpx;
		left: 0;
	}

	.box .username {
		// padding-left: 60rpx;
		// height: 100rpx;
		// padding-top: 100rpx;
		// font-size: 60rpx;
	}
</style>
